using System.Collections.Generic;

namespace RayDen.RayEngine.VertexFramework
{
    public class PathInfoBuffer : IEnumerable<PathInfo>
    {
        private PathInfo[] data;
        protected int readyCount;

        public IEnumerator<PathInfo> GetEnumerator()
        {
            return (IEnumerator<PathInfo>) data.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return data.GetEnumerator();
        }

        public bool IsReady { get { return readyCount == data.Length-1; } }

        public PathInfo PopFreePath()
        {
            if (readyCount < data.Length - 1)
            {
                return data[readyCount++];
            }

            return null;
        }


    }
}